Select an item randomlyΒΆ
random.choice(L)
Select an item randomly from a list.
import random
L = ['Red', 'Blue', 'Green', 'White', 'Black']
print(random.choice(L))
Output:
Black
random.choice(L)
import random
L = ['Red', 'Blue', 'Green', 'White', 'Black']
print(random.choice(L))
Output:
Black